public class Leetcode1250 {
    public boolean isGoodArray(int[] nums) {
        int tmp = nums[0];
        for (int num : nums) {
            tmp = gcd(tmp, num);
            if (tmp == 1) {
                return true;
            }
        }
        return false;
    }

    public int gcd(int num1, int num2) {
        return num1 == 0 ? num2 : gcd(num2 % num1, num1);
    }

}
